package com.hyz.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hyz.pojo.assetRetire.AssetRetire;
import com.hyz.pojo.assetRetire.AssetRetireResultEnum;
import com.hyz.service.AssetRetireService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/assetRetire")
public class AssetRetireController {

    @Autowired
    private AssetRetireService service;

    //根据id更新报废申请
    @PostMapping("/updateAssetRetireById")
    public boolean updateAssetRetireById(@RequestBody AssetRetire assetRetire){
        return service.updateById(assetRetire);
    }

    //获取报废申请
    @PostMapping("/getAssetRetires")
    public List<AssetRetire> getAssetRetires(@RequestBody AssetRetire assetRetire){
        QueryWrapper<AssetRetire> wrapper = new QueryWrapper<>(assetRetire);
        return service.list(wrapper);
    }

}
